<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
  <!--css样式引入-->
  <head th:replace="admin/common::head-fragment"></head>
  <script type="text/javascript">
    function submit() {
      let username = $("#login-username").val();
      let password = $("#login-password").val();
      if(username == "" || password == ""){
        swal("用户名或密码为空！",{
          icon: "warning",
          button: {
              text: "好的"
              }
          });
        return false;
      }else {
        $.ajax({
          type: "post",
          url: "/admin/checkLogin",
          data: {"username" : username,"password" : password},
          success: function (result) {
            if(result.resultCode == 200){
              location.href = "/admin/index";
            }else{
              swal(result.message,{
                icon: "error",
                button: {
                  text: "好的"
                }
              });
            }
          }
        })
      }
    }
  </script>

  <body>
    <div class="page login-page">
      <div class="container">
        <div class="form-outer text-center d-flex align-items-center">
          <div class="form-inner">
            <div class="logo text-uppercase"><span>由此进入</span><strong class="text-primary">博客后台</strong></div>
            <p>追  逐  雷  和  闪  电  的  力  量,  把  浩  瀚  的  海  洋  装  进  我  胸  膛, <span style="color: #aa5500"> "即  使  再  小  的  帆  也  能  远  航" </span></p>
            <form method="get" class="text-left form-validate">
              <div class="form-group-material">
                <input id="login-username" type="text" name="loginUsername" required data-msg="请输入用户密码" class="input-material">
                <label for="login-username" class="label-material">用户名称</label>
              </div>
              <div class="form-group-material">
                <input id="login-password" type="password" name="loginPassword" required="true" data-msg="请输入用户密码" class="input-material">
                <label for="login-password" class="label-material">用户密码</label>
              </div>
              <div class="form-group text-center"><a id="login" class="btn btn-primary" onclick="submit()">登 录</a>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
    <!--javascript-->
    <div th:replace="admin/common::JavaScript-fragment"></div>
  </body>
</html>